<template>
  <div class="dashboard-container">
    <div class="app-container">
      <el-card>
        <el-tabs>
          <!-- 放置页签 -->
          <el-tab-pane label="角色管理">
            <!-- 新增角色按钮 -->
            <el-row style="padding: 10px 0">
              <el-button icon="el-icon-plus" size="small" type="primary">
                新增角色
              </el-button>
            </el-row>
            <!-- 表格 -->
            <el-table>
              <el-table-column label="序号" width="120" />
              <el-table-column label="角色名称" width="240" />
              <el-table-column label="描述" />
              <el-table-column label="操作">
                <el-button size="small" type="success">分配权限</el-button>
                <el-button size="small" type="primary">编辑</el-button>
                <el-button size="small" type="danger">删除</el-button>
              </el-table-column>
            </el-table>
            <!-- 分页组件 -->
            <el-row
              type="flex"
              justify="center"
              align="middle"
              style="height: 60px"
            >
              <!-- 分页组件 -->
              <el-pagination layout="prev,pager,next" />
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="公司管理">
            <h1>黑马137</h1>
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>
<script>

import { getRoleList } from '../../api/setting'

export default {
  data () {
    return {
      //  角色列表
      list: [],
      // query语义化
      query: {
        page: 1, // 页码
        pagesize: 10 // 每页多少条数据
      },
      total: 0 // 总条数
    }
  },
  created () {
    this.getRoleList()
  },
  methods: {
    // 获取角色列表
    async getList () {
      const { total, rows } = await getRoleList(this.query) // total:总条数,rows:获取的数据
      console.log(rows)
      this.list = rows
      this.total = total
    }
  }

}
</script>

